<template>
	<view class="main">
		<view>list 滚动加载</view>
		<view class="list">
			<view v-for="(item,index) in list" :key="index">
				<view class="">
					{{ item }}
				</view>
			</view>
		</view> 
	</view> 
</template>
 <script>
	 /*
	  像UI官网一样去收集各种组件
	  select 
	  抽屉
	  弹出层
	  
	 */
	 import myAjax from '@/common/server.js';
	import qrcode from '@/components/Myqrcode/qrcode.vue'
   export default {
	   	  components:{qrcode},
            data() {
                return { 
					 page:1,
					 list:[],
                }
            },
			onLoad() {
				uni.pageScrollTo({
				    scrollTop: 1200
				})
			},
			onPullDownRefresh() {
				this.list=[]
				this.getData() 
			},
			onReachBottom(){
				this.page = this.page + 1;
				this.getData() 
			},
			mounted() {
				  this.getData()
			},
			methods:{
				getData(){
				 var arr = new Array(30).fill(1).map((e,i)=>i)
				 console.log("arr: ",arr.length);	 
			     try{
			     	var that = this;
			     	uni.request({
			     		url: 'https://www.httpbin.org/post',
			     		data:{
			     			list:arr
			     		 },
			     		method: 'POST', 
			     		dataType: 'json',
			     		success: function(res) {
			     			 	console.log("res: ",res);  
								console.log("res.data: ",res.data);  
								console.log("res.data.data: ",res.data.data);  
								console.log("res.data.data.list: ",res.data.data.list);  
								var tmp = JSON.parse(res.data.data)
								console.log("res.data.data.list: ",tmp.list);  
			     			  	 that.list =	that.list.concat(tmp.list);
			     		},
			     		fail: function(err) {
			     							// clogv
			     			console.log("err: ",err);  
			     		}
			     	 })
			     }catch(e){
			     	console.log("e: ",e);  
			     }finally{
					 uni.stopPullDownRefresh()
				 }
				}
			}
     }
 </script>
<style> 
.main{
	padding: 10px;
}
</style>

